
public class DoubleMap {
	private double [] values;
	private int width;
	private int height;
		
	public DoubleMap(int width, int height) {
		super();
		this.width = width;
		this.height = height;
		values = new double[width * height];
	}
	
	void set(int x, int y, double value) {
		checkRanges(x, y);
		values[x + y * width] = value;
	}

	private void checkRanges(int x, int y) {
		assert 0 <= x && x < width;
		assert 0 <= y && y < height;
	}
	
	double get(int x, int y) {
		checkRanges(x, y);
		return values[x + y * width];
	}
}
